package com.x.Part4_myDateDemo;

/**
 * ClassName: EmployeeTest
 * Package: IntelliJ IDEA
 * Description:
 * Written by HanXu
 * Create 2023/9/15 2:20
 */
public class EmployeeTest {
    public static void main(String[] args) {

        Employee emp1 = new Employee();

        emp1.age = 27;
        emp1.name = "Sherbledore";                     //String类型赋值写法一
        emp1.name = new String("Sherbledore"); //String类型赋值写法二
        emp1.id = 20260100;
        emp1.salary = 17000;

        //不进行new MyDate()会引起空指针异常:NullPointerException
        emp1.birthday = new MyDate();
        emp1.birthday.year = "1999";
        emp1.birthday.month = "1";
        emp1.birthday.day = "25";


        System.out.println("id = " + emp1.id + ", name = " + emp1.name +
                ", age = " + emp1.age + "岁, salary = " + emp1.salary +
                "元, birthday = " + emp1.birthday.year + "年" + emp1.birthday.month +
                "月" + emp1.birthday.day + "日");
    }
}
